// 工具函数：格式化日期为 YYYY-MM-DD HH:MM:SS
function formatDateToYY_MM_DD_HH_MM_SS(date) {
  const offset = 8 * 60; // UTC+8
  const localDate = new Date(date.getTime() + offset * 60 * 1000);

  const year = localDate.getUTCFullYear();
  const month = String(localDate.getUTCMonth() + 1).padStart(2, '0');
  const day = String(localDate.getUTCDate()).padStart(2, '0');
  const hours = String(localDate.getUTCHours()).padStart(2, '0');
  const minutes = String(localDate.getUTCMinutes()).padStart(2, '0');
  const seconds = String(localDate.getUTCSeconds()).padStart(2, '0');

  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

module.exports = {
  formatDateToYY_MM_DD_HH_MM_SS,
}